package {{package}}

import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping
import java.util.Optional

{{>generatedAnnotation}}
@Controller{{#beanQualifiers}}("{{package}}.{{classname}}Controller"){{/beanQualifiers}}
{{#useRequestMappingOnController}}
{{=<% %>=}}
@RequestMapping("\${openapi.<%title%>.base-path:<%>defaultBasePath%>}")
<%={{ }}=%>
{{/useRequestMappingOnController}}
{{#operations}}
class {{classname}}Controller(
        {{#skipDefaultDelegateInterface}}
        private val delegate: {{classname}}Delegate
        {{/skipDefaultDelegateInterface}}
        {{^skipDefaultDelegateInterface}}
        delegate: {{classname}}Delegate?
        {{/skipDefaultDelegateInterface}}
) : {{classname}} {
{{^skipDefaultDelegateInterface}}
    private lateinit var delegate: {{classname}}Delegate

    init {
        this.delegate = Optional.ofNullable(delegate).orElse(object : {{classname}}Delegate {})
    }
{{/skipDefaultDelegateInterface}}

    override fun getDelegate(): {{classname}}Delegate = delegate
}
{{/operations}}
